package com.lhy.tool.patchplugin.strategy;

import com.lhy.tool.patchplugin.PatchPluginProperties;
import com.lhy.tool.patchplugin.util.SpringUtil;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * 抽象java相关文件策略类
 */
@Getter
@Setter
public abstract class AbstractJavaFileStrategyImpl implements FileStrategy {

    @Autowired
    protected PatchPluginProperties patchPluginProperties;
    /**
     * 模块路径 例如：
     * "zzfw-interface/zzfw-template"
     */
    protected String modulePath;

    /**
     * 模块名称 例如：
     * zzfw-template
     */
    protected String moduleName;

    /**
     * 目标war包路径
     */
    protected List<String> targetWarModulePaths;

    public AbstractJavaFileStrategyImpl(String modulePath, List<String> targetWarModulePaths) {
        this.modulePath = modulePath;
        this.targetWarModulePaths = targetWarModulePaths;
        if(patchPluginProperties == null){
            this.patchPluginProperties = SpringUtil.getBean(PatchPluginProperties.class);
        }
        this.init();
    }

    @PostConstruct
    protected abstract void init();


}